package com.gton.controller;

import com.gton.annotation.SwaggerScanClass;
import com.gton.io.Resp;
import com.gton.service.DubboRPCUserManager;
import com.gton.service.GotoUserManagerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: GuoTong
 * @createTime: 2022-09-24 16:15
 * @since JDK 1.8 OR 11
 **/
@RestController
@Api(tags = "测试接口")
@SwaggerScanClass
public class RouterController {

    @Autowired
    private GotoUserManagerService gotoUserManagerService;

    @Autowired
    private DubboRPCUserManager dubboRPCUserManager;


    @RequestMapping(value = "/this_rest_to_userService", method = RequestMethod.GET)
    @ApiOperation(value = "thirdsysrouter服务调用usermanager", notes = "json格式")
    @ApiResponse(code = 200, message = "返回的是json格式", response = Resp.class)
    public Resp hello() {
        return gotoUserManagerService.getUserManagerService_Hello();
    }


    @RequestMapping(value = "/outSys_rest_to_this", method = RequestMethod.GET)
    @ApiOperation(value = "usermanager服务调用thirdsysrouter", notes = "json格式")
    @ApiResponse(code = 200, message = "返回的是json格式", response = Resp.class)
    public Resp sayHello() {
        return gotoUserManagerService.createMapData();
    }


    @RequestMapping(value = "/this_Dubbo_to_userService", method = RequestMethod.GET)
    @ApiOperation(value = "thirdsysrouter调用usermanager", notes = "json格式")
    @ApiResponse(code = 200, message = "返回的是json格式", response = Resp.class)
    public Resp this_Dubbo_to_userService() {
        return dubboRPCUserManager.requestUserManager();
    }
}
